package com.huitu.whht.base.core.api.wq.opcp;

import com.huitu.api.rest.AbstractApiResource;
import com.huitu.commons.PageUtils;
import com.huitu.whht.api.core.common.annotations.SzyCoreApiResource;
import com.huitu.whht.api.core.common.annotations.SzyCoreApiService;
import com.huitu.whht.api.core.common.response.ApiResultBuilder;
import com.huitu.whht.api.core.common.response.StatusRespBuilder;
import com.huitu.whht.api.core.common.util.LocalDateTimeUtil;
import com.huitu.whht.base.core.api.wq.opcp.entities.WqOpcpD;
import com.huitu.whht.base.core.api.wq.opcp.entities.WqOpcpDKey;
import com.huitu.whht.base.core.api.wq.opcp.entities.WqOpcpDQo;
import com.huitu.whht.base.core.api.wq.opcp.service.IWqOpcpDService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 说明: 测站有机农药类项目数据表API,表名称: WQ_OPCP_D <br/>
 * 日期: 2019-04-11
 * @author LiuCW
 */
@Component
@SzyCoreApiResource
@Path("wq/opcp/d")
public class WqOpcpDResource extends AbstractApiResource {

    private static final Logger LOGGER = LoggerFactory.getLogger(WqOpcpDResource.class);

    private static final String UUID = "f78b9346-01d3-40cc-8d73-62f8c5cb5713";

    @Override
    public String getUUID() {
        return UUID;
    }

    @Autowired
    @SzyCoreApiService
    IWqOpcpDService wqOpcpDService;

    /**
     * @api {get} wq/opcp/d/{stcd:\\w{8}}/{spt}/{prpnm:\\w{1}}/{lynm:\\w{1}}/{wbtp:\\w{1}} [R][G]根据主键查询
     * @apiDescription [G]根据主键查询WQ_OPCP_D(测站有机农药类项目数据表)数据
     * @apiName (generate)select by primary key
     * @apiGroup WQ_OPCP_D-测站有机农药类项目数据表
     * @apiVersion 1.0.0
     * @apiSampleRequest wq/opcp/d/{stcd}/{spt}/{prpnm}/{lynm}/{wbtp}
     * @apiParam   {String}         stcd               【必须】测站编码
     * @apiParam   {Date}           spt                【必须】采样时间
     * @apiParam   {String}         prpnm              【必须】水体类型
     * @apiParam   {String}         lynm               【必须】垂线编号
     * @apiParam   {String}         wbtp               【必须】层面编号
     * @apiSuccess {String}         stcd               测站编码
     * @apiSuccess {String}         lynm               垂线编号
     * @apiSuccess {String}         wbtp               层面编号
     * @apiSuccess {String}         prpnm              水体类型
     * @apiSuccess {Date}           spt                采样时间(时间格式 <font color='red'>yyyy-MM-dd HH:mm:ss</font>)
     * @apiSuccess {Double}         bhc                六六六
     * @apiSuccess {Double}         ddt                滴滴涕
     * @apiSuccess {Double}         rogor              乐果
     * @apiSuccess {Double}         dll                对硫磷
     * @apiSuccess {Double}         jjdll              甲基对硫磷
     * @apiSuccess {Double}         mlll               马拉硫磷
     * @apiSuccess {Double}         ddv                敌敌畏
     * @apiSuccess {Double}         dbch               敌百虫
     * @apiSuccess {Double}         atlj               阿特拉津
     * @apiSuccess {Double}         bjq                百菌清
     * @apiSuccess {Double}         jnw                甲萘威
     * @apiSuccess {Double}         xqjzh              溴氰菊酯
     * @apiSuccess {Double}         nxl                内吸磷
     * @apiSuccess {String}         nt                 备注
     * @apiSuccess {String}         speRegData         特殊区域
     * @apiSuccess {Date}           ts                 时间戳(时间格式 <font color='red'>yyyy-MM-dd HH:mm:ss</font>)
     * @apiSuccess {Date}           testComTm          化验完成时间(时间格式 <font color='red'>yyyy-MM-dd HH:mm:ss</font>)
     * @apiSuccessExample 请求成功:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "stcd": null,
     * "lynm": null,
     * "wbtp": null,
     * "prpnm": null,
     * "spt": null,
     * "bhc": null,
     * "ddt": null,
     * "rogor": null,
     * "dll": null,
     * "jjdll": null,
     * "mlll": null,
     * "ddv": null,
     * "dbch": null,
     * "atlj": null,
     * "bjq": null,
     * "jnw": null,
     * "xqjzh": null,
     * "nxl": null,
     * "nt": null,
     * "speRegData": null,
     * "ts": null,
     * "testComTm": null
     *  }
     * }
     * @apiUse exceptions
     */
    @GET
    @Path("{stcd:\\w{8}}/{spt}/{prpnm:\\w{1}}/{lynm:\\w{1}}/{wbtp:\\w{1}}")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response selectByPrimaryKey(@PathParam("stcd") String stcd,@PathParam("spt") String spt,@PathParam("prpnm") String prpnm,@PathParam("lynm") String lynm,@PathParam("wbtp") String wbtp) {
        WqOpcpDKey pk = new WqOpcpDKey();
        pk.setStcd(stcd);
        LocalDateTime.parse(spt,LocalDateTimeUtil.DATE_TIME_FORMATTER_YMD_HMS);
        pk.setPrpnm(prpnm);
        pk.setLynm(lynm);
        pk.setWbtp(wbtp);
        LOGGER.info("根据主键查询 测站有机农药类项目数据表,参数 pk:{}", pk);
        return Response.ok(ApiResultBuilder.create(this, wqOpcpDService.selectByPrimaryKey(pk))).build();
    }

    /**
     * @api {post} wq/opcp/d/list [R][G]根据条件查询
     * @apiDescription [G]根据条件查询WQ_OPCP_D(测站有机农药类项目数据表)数据
     * @apiName (generate)select by filter
     * @apiGroup WQ_OPCP_D-测站有机农药类项目数据表
     * @apiVersion 1.0.0
     * @apiSampleRequest wq/opcp/d/list
     * @apiParam   {String}         stcd               测站编码
     * @apiParam   {List(String)}   lynmList           (数组)垂线编号
     * @apiParam   {List(String)}   wbtpList           (数组)层面编号
     * @apiParam   {List(String)}   prpnmList          (数组)水体类型
     * @apiParam   {Date}           sptBgTm            (开始时间)采样时间
     * @apiParam   {Date}           sptEdTm            (结束时间)采样时间
     * @apiParam   {Double}         bhcMin             (最小)六六六
     * @apiParam   {Double}         bhcMax             (最大)六六六
     * @apiParam   {Double}         ddtMin             (最小)滴滴涕
     * @apiParam   {Double}         ddtMax             (最大)滴滴涕
     * @apiParam   {Double}         rogorMin           (最小)乐果
     * @apiParam   {Double}         rogorMax           (最大)乐果
     * @apiParam   {Double}         dllMin             (最小)对硫磷
     * @apiParam   {Double}         dllMax             (最大)对硫磷
     * @apiParam   {Double}         jjdllMin           (最小)甲基对硫磷
     * @apiParam   {Double}         jjdllMax           (最大)甲基对硫磷
     * @apiParam   {Double}         mlllMin            (最小)马拉硫磷
     * @apiParam   {Double}         mlllMax            (最大)马拉硫磷
     * @apiParam   {Double}         ddvMin             (最小)敌敌畏
     * @apiParam   {Double}         ddvMax             (最大)敌敌畏
     * @apiParam   {Double}         dbchMin            (最小)敌百虫
     * @apiParam   {Double}         dbchMax            (最大)敌百虫
     * @apiParam   {Double}         atljMin            (最小)阿特拉津
     * @apiParam   {Double}         atljMax            (最大)阿特拉津
     * @apiParam   {Double}         bjqMin             (最小)百菌清
     * @apiParam   {Double}         bjqMax             (最大)百菌清
     * @apiParam   {List(Double)}   jnwList            (数组)甲萘威
     * @apiParam   {Double}         xqjzhMin           (最小)溴氰菊酯
     * @apiParam   {Double}         xqjzhMax           (最大)溴氰菊酯
     * @apiParam   {Double}         nxlMin             (最小)内吸磷
     * @apiParam   {Double}         nxlMax             (最大)内吸磷
     * @apiParam   {String}         nt                 备注
     * @apiParam   {List(String)}   speRegDataList     (数组)特殊区域
     * @apiParam   {Date}           tsBgTm             (开始时间)时间戳
     * @apiParam   {Date}           tsEdTm             (结束时间)时间戳
     * @apiParam   {Date}           testComTmBgTm      (开始时间)化验完成时间
     * @apiParam   {Date}           testComTmEdTm      (结束时间)化验完成时间
     * @apiSuccess {String}         stcd               测站编码
     * @apiSuccess {String}         lynm               垂线编号
     * @apiSuccess {String}         wbtp               层面编号
     * @apiSuccess {String}         prpnm              水体类型
     * @apiSuccess {Date}           spt                采样时间
     * @apiSuccess {Double}         bhc                六六六
     * @apiSuccess {Double}         ddt                滴滴涕
     * @apiSuccess {Double}         rogor              乐果
     * @apiSuccess {Double}         dll                对硫磷
     * @apiSuccess {Double}         jjdll              甲基对硫磷
     * @apiSuccess {Double}         mlll               马拉硫磷
     * @apiSuccess {Double}         ddv                敌敌畏
     * @apiSuccess {Double}         dbch               敌百虫
     * @apiSuccess {Double}         atlj               阿特拉津
     * @apiSuccess {Double}         bjq                百菌清
     * @apiSuccess {Double}         jnw                甲萘威
     * @apiSuccess {Double}         xqjzh              溴氰菊酯
     * @apiSuccess {Double}         nxl                内吸磷
     * @apiSuccess {String}         nt                 备注
     * @apiSuccess {String}         speRegData         特殊区域
     * @apiSuccess {Date}           ts                 时间戳
     * @apiSuccess {Date}           testComTm          化验完成时间
     * @apiSuccessExample 请求成功:
     * HTTP/1.1 200 OK
     * {
     * "result": [{
     * "stcd": null,
     * "lynm": null,
     * "wbtp": null,
     * "prpnm": null,
     * "spt": null,
     * "bhc": null,
     * "ddt": null,
     * "rogor": null,
     * "dll": null,
     * "jjdll": null,
     * "mlll": null,
     * "ddv": null,
     * "dbch": null,
     * "atlj": null,
     * "bjq": null,
     * "jnw": null,
     * "xqjzh": null,
     * "nxl": null,
     * "nt": null,
     * "speRegData": null,
     * "ts": null,
     * "testComTm": null
     *  }]
     * }
     *
     * @apiSuccessExample 分页请求:
     * request header: Rang={max=50;size=50;field=TS DESC}
     * HTTP/1.1 200 OK
     * {
     * "result": [{
     * "stcd": null,
     * "lynm": null,
     * "wbtp": null,
     * "prpnm": null,
     * "spt": null,
     * "bhc": null,
     * "ddt": null,
     * "rogor": null,
     * "dll": null,
     * "jjdll": null,
     * "mlll": null,
     * "ddv": null,
     * "dbch": null,
     * "atlj": null,
     * "bjq": null,
     * "jnw": null,
     * "xqjzh": null,
     * "nxl": null,
     * "nt": null,
     * "speRegData": null,
     * "ts": null,
     * "testComTm": null
     *  }],
     * "paging": {
     * "count": 3,
     * "total": 120,
     * "finale": false,
     * "index": 1
     * }
     * }
     * @apiUse header_rang
     * @apiUse exceptions
     */
    @POST
    @Path("list")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response selectList(WqOpcpDQo filter) {
        PageUtils.startPageFromRang();
        LOGGER.info("根据条件查询 测站有机农药类项目数据表,参数 WqOpcpDQo:{}", filter);
        return Response.ok(ApiResultBuilder.create(this, wqOpcpDService.selectList(filter))).build();
    }

    /**
     * @api {put} wq/opcp/d [C][G]新增数据
     * @apiPrivate
     * @apiDescription [G]新增WQ_OPCP_D(测站有机农药类项目数据表)数据
     * @apiName (generate)add data
     * @apiGroup WQ_OPCP_D-测站有机农药类项目数据表
     * @apiVersion 1.0.0
     * @apiParam   {String}         stcd               【必须】测站编码
     * @apiParam   {String}         lynm               【必须】垂线编号
     * @apiParam   {String}         wbtp               【必须】层面编号
     * @apiParam   {String}         prpnm              【必须】水体类型
     * @apiParam   {Date}           spt                【必须】采样时间(时间格式 <font color='red'>yyyy-MM-dd HH:mm:ss</font>)
     * @apiParam   {Double}         bhc                六六六
     * @apiParam   {Double}         ddt                滴滴涕
     * @apiParam   {Double}         rogor              乐果
     * @apiParam   {Double}         dll                对硫磷
     * @apiParam   {Double}         jjdll              甲基对硫磷
     * @apiParam   {Double}         mlll               马拉硫磷
     * @apiParam   {Double}         ddv                敌敌畏
     * @apiParam   {Double}         dbch               敌百虫
     * @apiParam   {Double}         atlj               阿特拉津
     * @apiParam   {Double}         bjq                百菌清
     * @apiParam   {Double}         jnw                甲萘威
     * @apiParam   {Double}         xqjzh              溴氰菊酯
     * @apiParam   {Double}         nxl                内吸磷
     * @apiParam   {String}         nt                 备注
     * @apiParam   {String}         speRegData         特殊区域
     * @apiParam   {Date}           ts                 时间戳(时间格式 <font color='red'>yyyy-MM-dd HH:mm:ss</font>)
     * @apiParam   {Date}           testComTm          化验完成时间(时间格式 <font color='red'>yyyy-MM-dd HH:mm:ss</font>)
     * @apiSuccess {Integer}        status             1:新增成功;0:新增失败.
     * @apiSuccess {String}         message            成功/失败消息内容
     * @apiSuccess {Object}         data               额外返回的数据,通常包含新增数据的主键值
     * @apiSampleRequest wq/opcp/d
     * @apiSuccessExample 新增成功:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":1,
     * "message":"成功",
     * "data":{
     *   "stcd": null,
     *   "spt": null,
     *   "prpnm": null,
     *   "lynm": null,
     *   "wbtp": null
     *      }
     *   }
     * }
     @apiSuccessExample 新增失败:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":0,
     * "message":"失败",
     * "data":{
     *   "stcd": null,
     *   "spt": null,
     *   "prpnm": null,
     *   "lynm": null,
     *   "wbtp": null
     *      }
     *   }
     * }
     * @apiParamExample {json} 请求示例:
     * {
     * "stcd": null,
     * "lynm": null,
     * "wbtp": null,
     * "prpnm": null,
     * "spt": null,
     * "bhc": null,
     * "ddt": null,
     * "rogor": null,
     * "dll": null,
     * "jjdll": null,
     * "mlll": null,
     * "ddv": null,
     * "dbch": null,
     * "atlj": null,
     * "bjq": null,
     * "jnw": null,
     * "xqjzh": null,
     * "nxl": null,
     * "nt": null,
     * "speRegData": null,
     * "ts": null,
     * "testComTm": null
     * }
     * @apiUse exceptions
     */
    @PUT
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response insert(WqOpcpD record) {
        LOGGER.info("新增 测站有机农药类项目数据表,参数 WqOpcpD:{}", record);
        return Response.ok(ApiResultBuilder.create(this, StatusRespBuilder.insert(wqOpcpDService.insertSelective(record),record))).build();
    }

    /**
     * @api {post} wq/opcp/d/insertBatch [C][G]批量新增数据
     * @apiPrivate
     * @apiDescription [G]批量新增WQ_OPCP_D(测站有机农药类项目数据表)数据
     * @apiName (generate)addBatch data
     * @apiGroup WQ_OPCP_D-测站有机农药类项目数据表
     * @apiVersion 1.0.0
     * @apiParam   {String}         stcd               【必须】测站编码
     * @apiParam   {String}         lynm               【必须】垂线编号
     * @apiParam   {String}         wbtp               【必须】层面编号
     * @apiParam   {String}         prpnm              【必须】水体类型
     * @apiParam   {Date}           spt                【必须】采样时间(时间格式 <font color='red'>yyyy-MM-dd HH:mm:ss</font>)
     * @apiParam   {Double}         bhc                六六六
     * @apiParam   {Double}         ddt                滴滴涕
     * @apiParam   {Double}         rogor              乐果
     * @apiParam   {Double}         dll                对硫磷
     * @apiParam   {Double}         jjdll              甲基对硫磷
     * @apiParam   {Double}         mlll               马拉硫磷
     * @apiParam   {Double}         ddv                敌敌畏
     * @apiParam   {Double}         dbch               敌百虫
     * @apiParam   {Double}         atlj               阿特拉津
     * @apiParam   {Double}         bjq                百菌清
     * @apiParam   {Double}         jnw                甲萘威
     * @apiParam   {Double}         xqjzh              溴氰菊酯
     * @apiParam   {Double}         nxl                内吸磷
     * @apiParam   {String}         nt                 备注
     * @apiParam   {String}         speRegData         特殊区域
     * @apiParam   {Date}           ts                 时间戳(时间格式 <font color='red'>yyyy-MM-dd HH:mm:ss</font>)
     * @apiParam   {Date}           testComTm          化验完成时间(时间格式 <font color='red'>yyyy-MM-dd HH:mm:ss</font>)
     * @apiSuccess {Integer}        status             1:新增成功;0:新增失败.
     * @apiSuccess {String}         message            成功/失败消息内容
     * @apiSuccess {Object}         data               额外返回的数据,通常包含新增数据的主键值
     * @apiSampleRequest wq/opcp/d/insertBatch
     * @apiSuccessExample 新增成功:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":1,
     * "message":"成功",
     * "data":{
     *   "stcd": null,
     *   "spt": null,
     *   "prpnm": null,
     *   "lynm": null,
     *   "wbtp": null
     *      }
     *   }
     * }
     @apiSuccessExample 新增失败:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":0,
     * "message":"失败",
     * "data":{
     *   "stcd": null,
     *   "spt": null,
     *   "prpnm": null,
     *   "lynm": null,
     *   "wbtp": null
     *      }
     *   }
     * }
     * @apiParamExample {json} 请求示例:
     * [{
     * "stcd": null,
     * "lynm": null,
     * "wbtp": null,
     * "prpnm": null,
     * "spt": null,
     * "bhc": null,
     * "ddt": null,
     * "rogor": null,
     * "dll": null,
     * "jjdll": null,
     * "mlll": null,
     * "ddv": null,
     * "dbch": null,
     * "atlj": null,
     * "bjq": null,
     * "jnw": null,
     * "xqjzh": null,
     * "nxl": null,
     * "nt": null,
     * "speRegData": null,
     * "ts": null,
     * "testComTm": null
     * }]
     * @apiUse exceptions
     */
    @POST
    @Path("insertBatch")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response insertBatch(List<WqOpcpD> recordList) {
        LOGGER.info("批量新增 测站有机农药类项目数据表,参数 WqOpcpD:[]", recordList);
        return Response.ok(ApiResultBuilder.create(this, StatusRespBuilder.insert(wqOpcpDService.insertBatch(recordList),recordList))).build();
    }

    /**
     * @api {put} wq/opcp/d/{stcd:\\w{8}}/{spt}/{prpnm:\\w{1}}/{lynm:\\w{1}}/{wbtp:\\w{1}}/update [U][G]根据主键修改
     * @apiPrivate
     * @apiDescription [G]根据主键修改WQ_OPCP_D(测站有机农药类项目数据表)数据
     * @apiName (generate)update data
     * @apiGroup WQ_OPCP_D-测站有机农药类项目数据表
     * @apiVersion 1.0.0
     * @apiParam   {String}         stcd               【必须】测站编码
     * @apiParam   {String}         lynm               【必须】垂线编号
     * @apiParam   {String}         wbtp               【必须】层面编号
     * @apiParam   {String}         prpnm              【必须】水体类型
     * @apiParam   {Date}           spt                【必须】采样时间
     * @apiParam   {Double}         bhc                六六六
     * @apiParam   {Double}         ddt                滴滴涕
     * @apiParam   {Double}         rogor              乐果
     * @apiParam   {Double}         dll                对硫磷
     * @apiParam   {Double}         jjdll              甲基对硫磷
     * @apiParam   {Double}         mlll               马拉硫磷
     * @apiParam   {Double}         ddv                敌敌畏
     * @apiParam   {Double}         dbch               敌百虫
     * @apiParam   {Double}         atlj               阿特拉津
     * @apiParam   {Double}         bjq                百菌清
     * @apiParam   {Double}         jnw                甲萘威
     * @apiParam   {Double}         xqjzh              溴氰菊酯
     * @apiParam   {Double}         nxl                内吸磷
     * @apiParam   {String}         nt                 备注
     * @apiParam   {String}         speRegData         特殊区域
     * @apiParam   {Date}           ts                 【必须】时间戳
     * @apiParam   {Date}           testComTm          化验完成时间
     * @apiSuccess {Integer}        status             1:修改成功;0:要修改的数据不存在(可能已被删除)
     * @apiSuccess {String}         message            成功/失败消息内容
     * @apiSuccess {Object}         data               额外返回的数据
     * @apiSampleRequest wq/opcp/d/{stcd}/{spt}/{prpnm}/{lynm}/{wbtp}/update
     * @apiSuccessExample 修改成功:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":1,
     * "message":"成功",
     * "data":null
     *   }
     * }
     * @apiSuccessExample 修改失败:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":0,
     * "message":"失败",
     * "data":null
     *   }
     * }
     * @apiParamExample {json} 请求示例:
     * {
     * "stcd": null,
     * "lynm": null,
     * "wbtp": null,
     * "prpnm": null,
     * "spt": null,
     * "bhc": null,
     * "ddt": null,
     * "rogor": null,
     * "dll": null,
     * "jjdll": null,
     * "mlll": null,
     * "ddv": null,
     * "dbch": null,
     * "atlj": null,
     * "bjq": null,
     * "jnw": null,
     * "xqjzh": null,
     * "nxl": null,
     * "nt": null,
     * "speRegData": null,
     * "ts": null,
     * "testComTm": null
     * }
     * @apiUse exceptions
     */
    @PUT
    @Path("{stcd:\\w{8}}/{spt}/{prpnm:\\w{1}}/{lynm:\\w{1}}/{wbtp:\\w{1}}/update")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response update(@PathParam("stcd") String stcd,@PathParam("spt") String spt,@PathParam("prpnm") String prpnm,@PathParam("lynm") String lynm,@PathParam("wbtp") String wbtp, WqOpcpD record) {
        record.setStcd(stcd);
        LocalDateTime.parse(spt,LocalDateTimeUtil.DATE_TIME_FORMATTER_YMD_HMS);
        record.setPrpnm(prpnm);
        record.setLynm(lynm);
        record.setWbtp(wbtp);
        LOGGER.info("根据主键修改 测站有机农药类项目数据表,参数 WqOpcpD:{}", record);
        return Response.ok(ApiResultBuilder.create(this, StatusRespBuilder.update(wqOpcpDService.updateByPrimaryKey(record)))).build();
    }

    /**
     * @api {put} wq/opcp/d/{stcd:\\w{8}}/{spt}/{prpnm:\\w{1}}/{lynm:\\w{1}}/{wbtp:\\w{1}}/update-selective [U][G]根据主键修改(只修改非null字段)
     * @apiPrivate
     * @apiDescription [G]根据主键修改WQ_OPCP_D(测站有机农药类项目数据表)数据,只修改非null字段
     * @apiName (generate)update selected data
     * @apiGroup WQ_OPCP_D-测站有机农药类项目数据表
     * @apiVersion 1.0.0
     * @apiParam   {String}         stcd               测站编码
     * @apiParam   {String}         lynm               垂线编号
     * @apiParam   {String}         wbtp               层面编号
     * @apiParam   {String}         prpnm              水体类型
     * @apiParam   {Date}           spt                采样时间
     * @apiParam   {Double}         bhc                六六六
     * @apiParam   {Double}         ddt                滴滴涕
     * @apiParam   {Double}         rogor              乐果
     * @apiParam   {Double}         dll                对硫磷
     * @apiParam   {Double}         jjdll              甲基对硫磷
     * @apiParam   {Double}         mlll               马拉硫磷
     * @apiParam   {Double}         ddv                敌敌畏
     * @apiParam   {Double}         dbch               敌百虫
     * @apiParam   {Double}         atlj               阿特拉津
     * @apiParam   {Double}         bjq                百菌清
     * @apiParam   {Double}         jnw                甲萘威
     * @apiParam   {Double}         xqjzh              溴氰菊酯
     * @apiParam   {Double}         nxl                内吸磷
     * @apiParam   {String}         nt                 备注
     * @apiParam   {String}         speRegData         特殊区域
     * @apiParam   {Date}           ts                 时间戳
     * @apiParam   {Date}           testComTm          化验完成时间
     * @apiSuccess {Integer}        status             1:修改成功;0:要修改的数据不存在(可能已被删除)
     * @apiSuccess {String}         message            成功/失败消息内容
     * @apiSuccess {Object}         data               额外返回的数据
     * @apiSampleRequest wq/opcp/d/{stcd}/{spt}/{prpnm}/{lynm}/{wbtp}/update-selective
     * * @apiSuccessExample 修改成功:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":1,
     * "message":"成功",
     * "data":null
     *   }
     * }
     * @apiSuccessExample 修改失败:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":0,
     * "message":"失败",
     * "data":null
     *   }
     * }
     * @apiParamExample {json} 请求示例:
     * {
     * "stcd": null,
     * "lynm": null,
     * "wbtp": null,
     * "prpnm": null,
     * "spt": null,
     * "bhc": null,
     * "ddt": null,
     * "rogor": null,
     * "dll": null,
     * "jjdll": null,
     * "mlll": null,
     * "ddv": null,
     * "dbch": null,
     * "atlj": null,
     * "bjq": null,
     * "jnw": null,
     * "xqjzh": null,
     * "nxl": null,
     * "nt": null,
     * "speRegData": null,
     * "ts": null,
     * "testComTm": null
     * }
     * @apiUse exceptions
     */
    @PUT
    @Path("{stcd:\\w{8}}/{spt}/{prpnm:\\w{1}}/{lynm:\\w{1}}/{wbtp:\\w{1}}/update-selective")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response updateSelective(@PathParam("stcd") String stcd,@PathParam("spt") String spt,@PathParam("prpnm") String prpnm,@PathParam("lynm") String lynm,@PathParam("wbtp") String wbtp, WqOpcpD record) {
        record.setStcd(stcd);
        LocalDateTime.parse(spt,LocalDateTimeUtil.DATE_TIME_FORMATTER_YMD_HMS);
        record.setPrpnm(prpnm);
        record.setLynm(lynm);
        record.setWbtp(wbtp);
        LOGGER.info("根据主键修改(只修改非null字段) 测站有机农药类项目数据表,参数 WqOpcpD:{}", record);
        return Response.ok(ApiResultBuilder.create(this, StatusRespBuilder.update(wqOpcpDService.updateByPrimaryKeySelective(record)))).build();
    }

    /**
     * @api {post} wq/opcp/d/updateBatch [U][G]根据主键批量修改(只修改非null字段)
     * @apiPrivate
     * @apiDescription [G]根据批量主键修改WQ_OPCP_D(测站有机农药类项目数据表)数据,只修改非null字段
     * @apiName (generate)updateBatch selected data
     * @apiGroup WQ_OPCP_D-测站有机农药类项目数据表
     * @apiVersion 1.0.0
     * @apiParam   {String}         stcd               测站编码
     * @apiParam   {String}         lynm               垂线编号
     * @apiParam   {String}         wbtp               层面编号
     * @apiParam   {String}         prpnm              水体类型
     * @apiParam   {Date}           spt                采样时间
     * @apiParam   {Double}         bhc                六六六
     * @apiParam   {Double}         ddt                滴滴涕
     * @apiParam   {Double}         rogor              乐果
     * @apiParam   {Double}         dll                对硫磷
     * @apiParam   {Double}         jjdll              甲基对硫磷
     * @apiParam   {Double}         mlll               马拉硫磷
     * @apiParam   {Double}         ddv                敌敌畏
     * @apiParam   {Double}         dbch               敌百虫
     * @apiParam   {Double}         atlj               阿特拉津
     * @apiParam   {Double}         bjq                百菌清
     * @apiParam   {Double}         jnw                甲萘威
     * @apiParam   {Double}         xqjzh              溴氰菊酯
     * @apiParam   {Double}         nxl                内吸磷
     * @apiParam   {String}         nt                 备注
     * @apiParam   {String}         speRegData         特殊区域
     * @apiParam   {Date}           ts                 时间戳
     * @apiParam   {Date}           testComTm          化验完成时间
     * @apiSuccess {Integer}        status             1:修改成功;0:要修改的数据不存在(可能已被删除)
     * @apiSuccess {String}         message            成功/失败消息内容
     * @apiSuccess {Object}         data               额外返回的数据
     * @apiSampleRequest  wq/opcp/d/updateBatch
     * * @apiSuccessExample 修改成功:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":1,
     * "message":"成功",
     * "data":null
     *   }
     * }
     * @apiSuccessExample 修改失败:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":0,
     * "message":"失败",
     * "data":null
     *   }
     * }
     * @apiParamExample {json} 请求示例:
     * [{
     * "stcd": null,
     * "lynm": null,
     * "wbtp": null,
     * "prpnm": null,
     * "spt": null,
     * "bhc": null,
     * "ddt": null,
     * "rogor": null,
     * "dll": null,
     * "jjdll": null,
     * "mlll": null,
     * "ddv": null,
     * "dbch": null,
     * "atlj": null,
     * "bjq": null,
     * "jnw": null,
     * "xqjzh": null,
     * "nxl": null,
     * "nt": null,
     * "speRegData": null,
     * "ts": null,
     * "testComTm": null
     * }]
     * @apiUse exceptions
     */
    @POST
    @Path("updateBatch")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response updateBatch(List<WqOpcpD> record) {
        LOGGER.info("根据主键批量修改(只修改非null字段) 测站有机农药类项目数据表,参数 WqOpcpD:{}", record);
        return Response.ok(ApiResultBuilder.create(this, StatusRespBuilder.update(wqOpcpDService.updateBatch(record)))).build();
    }

    /**
     * @api {delete} wq/opcp/d/{stcd:\\w{8}}/{spt}/{prpnm:\\w{1}}/{lynm:\\w{1}}/{wbtp:\\w{1}} [D][G]根据主键删除
     * @apiPrivate
     * @apiDescription [G]根据主键删除WQ_OPCP_D(测站有机农药类项目数据表)数据
     * @apiName (generate)delete by primary key
     * @apiGroup WQ_OPCP_D-测站有机农药类项目数据表
     * @apiVersion 1.0.0
     * @apiSampleRequest wq/opcp/d/{stcd}/{spt}/{prpnm}/{lynm}/{wbtp}
     * @apiParam   {String}         stcd               【必须】测站编码
     * @apiParam   {Date}           spt                【必须】采样时间
     * @apiParam   {String}         prpnm              【必须】水体类型
     * @apiParam   {String}         lynm               【必须】垂线编号
     * @apiParam   {String}         wbtp               【必须】层面编号
     * @apiSuccess {Integer}        status             1:删除成功;0:要删除的数据不存在(可能已被删除).
     * @apiSuccess {String}         message            成功/失败消息内容
     * @apiSuccess {Object}         data               额外返回的数据
     * @apiSuccessExample 删除成功:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":1,
     * "message":"成功",
     * "data":null
     *   }
     * }
     * @apiSuccessExample 删除失败:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":0,
     * "message":"失败",
     * "data":null
     *   }
     * }
     * @apiUse exceptions
     */
    @DELETE
    @Path("{stcd:\\w{8}}/{spt}/{prpnm:\\w{1}}/{lynm:\\w{1}}/{wbtp:\\w{1}}")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response delete(@PathParam("stcd") String stcd,@PathParam("spt") String spt,@PathParam("prpnm") String prpnm,@PathParam("lynm") String lynm,@PathParam("wbtp") String wbtp) {
         WqOpcpDKey pk = new WqOpcpDKey();
        pk.setStcd(stcd);
        LocalDateTime.parse(spt,LocalDateTimeUtil.DATE_TIME_FORMATTER_YMD_HMS);
        pk.setPrpnm(prpnm);
        pk.setLynm(lynm);
        pk.setWbtp(wbtp);
        LOGGER.info("根据主键删除 测站有机农药类项目数据表,参数 pk:{}", pk);
        Integer rows = wqOpcpDService.deleteByPrimaryKey(pk);
        return Response.ok(ApiResultBuilder.create(this, StatusRespBuilder.delete(rows))).build();
    }

    /**
     * @api {delete} wq/opcp/d/by-filter [D][G]根据条件删除
     * @apiPrivate
     * @apiDescription [G]根据条件删除WQ_OPCP_D(测站有机农药类项目数据表)数据
     * @apiName (generate)delete by filter
     * @apiGroup WQ_OPCP_D-测站有机农药类项目数据表
     * @apiVersion 1.0.0
     * @apiSampleRequest wq/opcp/d/by-filter
     * @apiParam   {String}         stcd               测站编码
     * @apiParam   {List(String)}   lynmList           (数组)垂线编号
     * @apiParam   {List(String)}   wbtpList           (数组)层面编号
     * @apiParam   {List(String)}   prpnmList          (数组)水体类型
     * @apiParam   {Date}           sptBgTm            (开始时间)采样时间
     * @apiParam   {Date}           sptEdTm            (结束时间)采样时间
     * @apiParam   {Double}         bhcMin             (最小)六六六
     * @apiParam   {Double}         bhcMax             (最大)六六六
     * @apiParam   {Double}         ddtMin             (最小)滴滴涕
     * @apiParam   {Double}         ddtMax             (最大)滴滴涕
     * @apiParam   {Double}         rogorMin           (最小)乐果
     * @apiParam   {Double}         rogorMax           (最大)乐果
     * @apiParam   {Double}         dllMin             (最小)对硫磷
     * @apiParam   {Double}         dllMax             (最大)对硫磷
     * @apiParam   {Double}         jjdllMin           (最小)甲基对硫磷
     * @apiParam   {Double}         jjdllMax           (最大)甲基对硫磷
     * @apiParam   {Double}         mlllMin            (最小)马拉硫磷
     * @apiParam   {Double}         mlllMax            (最大)马拉硫磷
     * @apiParam   {Double}         ddvMin             (最小)敌敌畏
     * @apiParam   {Double}         ddvMax             (最大)敌敌畏
     * @apiParam   {Double}         dbchMin            (最小)敌百虫
     * @apiParam   {Double}         dbchMax            (最大)敌百虫
     * @apiParam   {Double}         atljMin            (最小)阿特拉津
     * @apiParam   {Double}         atljMax            (最大)阿特拉津
     * @apiParam   {Double}         bjqMin             (最小)百菌清
     * @apiParam   {Double}         bjqMax             (最大)百菌清
     * @apiParam   {List(Double)}   jnwList            (数组)甲萘威
     * @apiParam   {Double}         xqjzhMin           (最小)溴氰菊酯
     * @apiParam   {Double}         xqjzhMax           (最大)溴氰菊酯
     * @apiParam   {Double}         nxlMin             (最小)内吸磷
     * @apiParam   {Double}         nxlMax             (最大)内吸磷
     * @apiParam   {String}         nt                 备注
     * @apiParam   {List(String)}   speRegDataList     (数组)特殊区域
     * @apiParam   {Date}           tsBgTm             (开始时间)时间戳
     * @apiParam   {Date}           tsEdTm             (结束时间)时间戳
     * @apiParam   {Date}           testComTmBgTm      (开始时间)化验完成时间
     * @apiParam   {Date}           testComTmEdTm      (结束时间)化验完成时间
     * @apiSuccess {Integer}        status             通常1或者>1:删除成功;0:没有符合条件的数据.
     * @apiSuccess {String}         message            成功/失败消息内容
     * @apiSuccess {Object}         data               额外返回的数据
     * @apiSuccessExample 删除成功:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":1,
     * "message":"成功",
     * "data":null
     *   }
     * }
     * @apiSuccessExample 删除失败:
     * HTTP/1.1 200 OK
     * {
     * "result": {
     * "status":0,
     * "message":"失败",
     * "data":null
     *   }
     * }
     * @apiUse exceptions
     */
    @DELETE
    @Path("by-filter")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Response deleteByFilter(WqOpcpDQo filter) {
        LOGGER.info("根据条件删除 测站有机农药类项目数据表,参数 WqOpcpDQo:{}", filter);
        Integer rows = wqOpcpDService.deleteByFilter(filter);
        return Response.ok(ApiResultBuilder.create(this, StatusRespBuilder.delete(rows))).build();
    }
}
